Crate str_utils

source ·
Expand description

str Utils

This crate provides some traits to extend types which implement AsRef<[u8]> or AsRef<str>.

Examples

use str_utils::*;

assert_eq!(true, "foobar".starts_with_ignore_ascii_case("FoO"));
assert_eq!(Some(1), "photo.jpg".ends_with_ignore_ascii_case_multiple(&[".png", ".jpg", ".gif"]));
assert_eq!(true, "http".eq_ignore_ascii_case_with_uppercase("HTTP")); // faster than `eq_ignore_ascii_case`

Traits

  • To extend types which implement AsRef<[u8]> to have ends_with_ignore_ascii_case, ends_with_ignore_ascii_case_with_lowercase and ends_with_ignore_ascii_case_with_uppercase methods.
  • To extend types which implement AsRef<[u8]> to have ends_with_ignore_ascii_case_multiple, ends_with_ignore_ascii_case_with_lowercase_multiple and ends_with_ignore_ascii_case_with_uppercase_multiple methods.
  • To extend types which implement AsRef<str> to have a ends_with_ignore_case method.
  • To extend types which implement AsRef<[u8]> to have a ends_with_multiple method.
  • To extend types which implement AsRef<[u8]> to have eq_ignore_ascii_case_with_lowercase and eq_ignore_ascii_case_with_uppercase methods.
  • To extend types which implement AsRef<[u8]> to have eq_ignore_ascii_case_multiple, eq_ignore_ascii_case_with_lowercase_multiple and eq_ignore_ascii_case_with_uppercase_multiple methods.
  • To extend types which implement AsRef<str> to have a eq_ignore_case method.
  • To extend types which implement AsRef<[u8]> to have a eq_multiple method.
  • To extend types which implement AsRef<[u8]> to have starts_with_ignore_ascii_case, starts_with_ignore_ascii_case_with_lowercase and starts_with_ignore_ascii_case_with_uppercase methods.
  • To extend types which implement AsRef<[u8]> to have starts_with_ignore_ascii_case_multiple, starts_with_ignore_ascii_case_with_lowercase_multiple and starts_with_ignore_ascii_case_with_uppercase_multiple methods.
  • To extend types which implement AsRef<str> to have a starts_with_ignore_case method.
  • To extend types which implement AsRef<[u8]> to have a starts_with_multiple method.